import { createRouter, createWebHashHistory } from 'vue-router'

// 路由器
const routes = [
    {
        path: '/',
        name: 'login',
        meta: { title: '登录页面' },
        component: () => import('../views/login.vue')
    },
    {
        path: '/index',
        name: 'index',
        component: () => import('../layout/index.vue'),
        children: [
            {
                path: '',
                name: 'dashboard',
                meta: { title: '控制面板' },
                component: () => import('../views/index.vue')
            },
            // 会员管理
            {
                path: '/member',
                name: 'member',
                meta: { title: '会员管理' },
                component: () => import('../views/member/index.vue')
            },
            // 商品管理
            {
                path: '/product',
                name: 'product',
                meta: { title: '商品管理' },
                component: () => import('../views/product/index.vue')
            },
            {
                path: '/product/add',
                name: 'productAdd',
                meta: { title: '添加商品' },
                component: () => import('../views/product/add.vue')
            },
            {
                path: '/product/edit/:id',
                name: 'productEdit',
                meta: { title: '编辑商品' },
                component: () => import('../views/product/edit.vue')
            },
            // 精品课程管理
            {
                path: '/course',
                name: 'course',
                meta: { title: '精品课程管理' },
                component: () => import('../views/course/index.vue')
            },
            {
                path: '/course/add',
                name: 'courseAdd',
                meta: { title: '添加课程' },
                component: () => import('../views/course/add.vue')
            },
            {
                path: '/course/edit/:id',
                name: 'courseEdit',
                meta: { title: '编辑课程' },
                component: () => import('../views/course/edit.vue')
            },
            // 讲师管理
            {
                path: '/instructor',
                name: 'instructor',
                meta: { title: '讲师管理' },
                component: () => import('../views/instructor/index.vue')
            },
            {
                path: '/instructor/add',
                name: 'instructorAdd',
                meta: { title: '添加讲师' },
                component: () => import('../views/instructor/add.vue')
            },
            {
                path: '/instructor/edit/:id',
                name: 'instructorEdit',
                meta: { title: '编辑讲师' },
                component: () => import('../views/instructor/edit.vue')
            },
            // 周刊管理
            {
                path: '/weekly',
                name: 'weekly',
                meta: { title: '周刊管理' },
                component: () => import('../views/weekly/index.vue')
            },
            {
                path: '/weekly/add',
                name: 'weeklyAdd',
                meta: { title: '添加周刊' },
                component: () => import('../views/weekly/add.vue')
            },
            {
                path: '/weekly/edit/:id',
                name: 'weeklyEdit',
                meta: { title: '编辑周刊' },
                component: () => import('../views/weekly/edit.vue')
            },
            // 系统设置
            {
                path: '/settings',
                name: 'settings',
                meta: { title: '系统设置' },
                component: () => import('../views/settings/index.vue')
            },
            // 轮播图管理
            {
                path: '/settings/banner',
                name: 'bannerSettings',
                meta: { title: '轮播图管理' },
                component: () => import('../views/settings/banner.vue')
            },
            // 小程序模块管理
            {
                path: '/settings/modules',
                name: 'moduleSettings',
                meta: { title: '小程序模块管理' },
                component: () => import('../views/settings/modules.vue')
            },
            // 积分设置
            {
                path: '/settings/points',
                name: 'pointsSettings',
                meta: { title: '积分设置' },
                component: () => import('../views/settings/points.vue')
            },
            // 积分列表
            {
                path: '/settings/points-list',
                name: 'pointsList',
                meta: { title: '积分管理' },
                component: () => import('../views/settings/points-list.vue')
            }
        ]
    }
]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router

